from .base import Base
from .common import CommonMixin
from sqlalchemy import String, Integer, Column, SmallInteger, text, ForeignKey
from sqlalchemy.orm import relationship

""" 用户角色表 """


class UserRole(Base, CommonMixin):
    __tablename__ = 'user_role'

    id = Column(Integer, primary_key=True, comment='主键ID', autoincrement=True)
    user_id = Column(ForeignKey("user.id"), comment="用户id")
    role_id = Column(ForeignKey("role.id"), comment="角色id")

    user = relationship("User", back_populates="user_role", lazy=False)
    role = relationship("Role", back_populates="user_role", lazy=False)
